/*
 * Copyright 2006 Google Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.google.gwt.junit.client;

import junit.framework.TestCase;

/**
 * This class is the web mode version of the
 * {@link com.google.gwt.dev.junit.client.GWTTestCase} class that is used in
 * hosted mode. It is purposefully empty since none of its contents are used in web
 * mode.
 */
public class GWTTestCase extends TestCase {
  public native void addCheckpoint(String msg) /*-{
    window.external.junit["@com.google.gwt.dev.GWTUnitTestShell$UnitTestExternal::addCheckpoint(Ljava/lang/String;)"](msg);
  }-*/;

  public native void clearCheckpoints() /*-{
    window.external.junit["@com.google.gwt.dev.GWTUnitTestShell$UnitTestExternal::clearCheckpoints(Ljava/lang/String;)"](msg);
  }-*/;

  public native String[] getCheckpoints() /*-{
    return window.external.junit["@com.google.gwt.dev.GWTUnitTestShell$UnitTestExternal::getCheckpoints()"]();
  }-*/;
  
  public native void finishTestMethod() /*-{
    window.external.junit["@com.google.gwt.dev.GWTUnitTestShell$UnitTestExternal::finishTestMethod()"]();
  }-*/;
  
  public native void addError(Throwable e, String m) /*-{
    window.external.junit["@com.google.gwt.dev.GWTUnitTestShell$UnitTestExternal::addError(Ljava/lang/Throwable;Ljava/lang/String;)"](e, m);
  }-*/;

  public native void addFailure(String msg, StackTraceElement[] stackTrace) /*-{
    window.external.junit["@com.google.gwt.dev.GWTUnitTestShell$UnitTestExternal::addFailure(Ljava/lang/String;[Ljava/lang/StackTraceElement;)"](msg, stackTrace);
  }-*/;

  public native String getTestName() /*-{
    return window.external.junit["@com.google.gwt.dev.GWTUnitTestShell$UnitTestExternal::getTestName()"]();
  }-*/;
  
  public boolean catchExceptions() {
    return true;
  }
  
  protected final void setUp() throws Exception {
    // not supported at present
  }

  protected final void tearDown() throws Exception {
    // not supported at present
  }
}
